package com.mystyle.le.weekproject.adapter;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.mystyle.le.weekproject.R;

/**
 * Created by le on 2016/10/14.
 */
public class TalkCollectCursorAdapter extends CursorAdapter {

    public TalkCollectCursorAdapter(Context context, Cursor c) {
        super(context, c);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        return LayoutInflater.from(context).inflate(R.layout.talk_layout,parent,false);
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        TextView talk_name = (TextView) view.findViewById(R.id.talk_name);
        TextView talk_createtime = (TextView) view.findViewById(R.id.talk_createtime);
        TextView talk_text = (TextView) view.findViewById(R.id.talk_text);
        Button talk_commend = (Button) view.findViewById(R.id.talk_commend);
        Button talk_collect = (Button) view.findViewById(R.id.talk_collect);
        Button talk_share = (Button) view.findViewById(R.id.talk_share);
        talk_name.setText(cursor.getString(cursor.getColumnIndex("name")));
        talk_createtime.setText(cursor.getString(cursor.getColumnIndex("createtime")));
        talk_text.setText(cursor.getString(cursor.getColumnIndex("text")));
        talk_commend.setText(cursor.getString(cursor.getColumnIndex("commend")));
    }
}
